home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-08-09 | 54.9 KB | 1,016 lines |
- pcl!doc.ic.ac.uk!pipex!uunet!noc.near.net!das-news.harvard.edu!cantaloupe.srv.cs.cmu.edu!tgl Tue Jun 29 06:30:17 BST 1993
- Article: 33320 of comp.graphics
- Xref: pcl comp.graphics:33320 alt.graphics.pixutils:4541 alt.binaries.pictures.utilities:4626 alt.binaries.pictures.d:6800 alt.binaries.pictures.erotica.d:662 news.answers:8500
- Newsgroups: comp.graphics,alt.graphics.pixutils,alt.binaries.pictures.utilities,alt.binaries.pictures.d,alt.binaries.pictures.erotica.d,comp.answers,alt.answers,news.answers
- Path: pcl!doc.ic.ac.uk!pipex!uunet!noc.near.net!das-news.harvard.edu!cantaloupe.srv.cs.cmu.edu!tgl
- From: tgl+@cs.cmu.edu (Tom Lane)
- Subject: JPEG image compression: Frequently Asked Questions
- Message-ID: <jpeg-faq_741323505@g.gp.cs.cmu.edu>
- Followup-To: alt.binaries.pictures.d
- Summary: Useful info about JPEG (JPG) image files and programs
- Keywords: JPEG, image compression, FAQ
- Sender: news@cs.cmu.edu (Usenet News System)
- Supersedes: <jpeg-faq_740115611@g.gp.cs.cmu.edu>
- Nntp-Posting-Host: g.gp.cs.cmu.edu
- Reply-To: jpeg-info@uunet.uu.net
- Organization: School of Computer Science, Carnegie Mellon
- Date: Tue, 29 Jun 1993 03:11:53 GMT
- Approved: news-answers-request@MIT.Edu
- Expires: Tue, 27 Jul 1993 03:11:45 GMT
- Lines: 1068
-
- Archive-name: jpeg-faq
- Last-modified: 28 June 1993
-
- This article discusses JPEG image compression. Suggestions for additions
- and clarifications are welcome.
-
- New since version of 14 June 1993:
- * Substantial reorganization and rewriting. Not all that much new info,
- but I hope it's better presented now.
-
-
- This article includes the following sections:
-
- [1] What is JPEG?
- [2] Why use JPEG?
- [3] When should I use JPEG, and when should I stick with GIF?
- [4] How well does JPEG compress images?
- [5] What are good "quality" settings for JPEG?
- [6] Where can I get JPEG software?
- [6A] viewers, application programs, etc.
- [6B] source code
- [7] What's all this hoopla about color quantization?
- [8] What are some rules of thumb for converting GIF images to JPEG?
- [9] Does loss accumulate with repeated compression/decompression?
- [10] Why all the argument about file formats?
- [11] How do I recognize which file format I have, and what do I do about it?
- [12] How does JPEG work?
- [13] Isn't there a lossless JPEG?
- [14] What about arithmetic coding?
-
- Sections 1-6 are basic info that every JPEG user needs to know;
- sections 7-14 are more advanced info.
-
- This article is posted every 2 weeks. You can always find the latest
- version in the news.answers archive at rtfm.mit.edu (18.70.0.224). By FTP,
- fetch /pub/usenet/news.answers/jpeg-faq; or if you don't have FTP, send
- e-mail to mail-server@rtfm.mit.edu with body
- send usenet/news.answers/jpeg-faq
- Many other FAQ articles are also stored in the same archive. For more
- instructions on use of the archive, send mail to the server with the words
- "help" and "index" (without quotes) on separate lines. If you don't get a
- reply, the server may be misreading your return address; add a line such as
- "path myname@mysite" to specify your correct e-mail address to reply to.
-
-
- ----------
-
-
- [1] What is JPEG?
-
- JPEG (pronounced "jay-peg") is a standardized image compression mechanism.
- JPEG stands for Joint Photographic Experts Group, the original name of the
- committee that wrote the standard.
-
- JPEG is designed for compressing either full-color or gray-scale images
- of natural, real-world scenes. It works well on photographs, naturalistic
- artwork, and similar material; not so well on lettering, simple cartoons,
- or line drawings. JPEG handles only still images, but there is a related
- standard called MPEG for motion pictures.
-
- JPEG is "lossy," meaning that the decompressed image isn't quite the same as
- the one you started with. (There are lossless image compression algorithms,
- but JPEG achieves much greater compression than is possible with lossless
- methods.) JPEG is designed to exploit known limitations of the human eye,
- notably the fact that small color details aren't perceived as well as small
- details of light-and-dark. Thus, JPEG is intended for compressing images
- that will be looked at by humans. If you plan to machine-analyze your
- images, the small errors introduced by JPEG may be a problem for you, even
- if they are invisible to the eye.
-
- A useful property of JPEG is that the degree of lossiness can be varied by
- adjusting compression parameters. This means that the image maker can trade
- off file size against output image quality. You can make *extremely* small
- files if you don't mind poor quality; this is useful for applications like
- indexing image archives. Conversely, if you aren't happy with the output
- quality at the default compression setting, you can jack up the quality
- until you are satisfied, and accept lesser compression.
-
-
- [2] Why use JPEG?
-
- There are two good reasons: to make your image files smaller, and to store
- 24-bit-per-pixel color data instead of 8-bit-per-pixel data.
-
- Making image files smaller is a big win for transmitting files across
- networks and for archiving libraries of images. Being able to compress a
- 2 Mbyte full-color file down to 100 Kbytes or so makes a big difference in
- disk space and transmission time! (If you are comparing GIF and JPEG, the
- size ratio is more like four to one. More details in section 4.)
-
- If your viewing software doesn't support JPEG directly, you'll have to
- convert JPEG to some other format for viewing or manipulating images. Even
- with a JPEG-capable viewer, it takes longer to decode and view a JPEG image
- than to view an image of a simpler format such as GIF. Thus, using JPEG is
- essentially a time/space tradeoff: you give up some time in order to store
- or transmit an image more cheaply.
-
- It's worth noting that when network or phone transmission is involved, the
- time savings from transferring a shorter file can be greater than the extra
- time to decompress the file.
-
- The second fundamental advantage of JPEG is that it stores full color
- information: 24 bits/pixel (16 million colors). GIF, the other image format
- widely used on Usenet, can only store 8 bits/pixel (256 or fewer colors).
- GIF is reasonably well matched to inexpensive computer displays --- most
- run-of-the-mill PCs can't display more than 256 distinct colors at once.
- But full-color hardware is getting cheaper all the time, and JPEG images
- look *much* better than GIFs on such hardware. Within a couple of years,
- 8-bit GIF will seem as obsolete as black-and-white MacPaint format does
- today. Furthermore, for reasons detailed in section 7, JPEG is far more
- useful than GIF for exchanging images among people with widely varying
- display hardware. Hence JPEG is considerably more appropriate than GIF for
- use as a Usenet posting standard.
-
-
- [3] When should I use JPEG, and when should I stick with GIF?
-
- JPEG is *not* going to displace GIF entirely; for some types of images,
- GIF is superior in image quality, file size, or both. One of the first
- things to learn about JPEG is which kinds of images to apply it to.
-
- Generally speaking, JPEG is superior to GIF for storing full-color or
- gray-scale images of "realistic" scenes; that means scanned photographs and
- similar material. Any continuous variation in color, such as occurs in
- highlighted or shaded areas, will be represented more faithfully and in less
- space by JPEG than by GIF.
-
- GIF does significantly better on images with only a few distinct colors,
- such as line drawings and simple cartoons. Not only is GIF lossless for
- such images, but it often compresses them more than JPEG can. For example,
- large areas of pixels that are all *exactly* the same color are compressed
- very efficiently indeed by GIF. JPEG can't squeeze such data as much as GIF
- does without introducing visible defects. (One implication of this is that
- large single-color borders are quite cheap in GIF files, while they are best
- avoided in JPEG files.)
-
- Computer-drawn images (ray-traced scenes, for instance) usually fall between
- photographs and cartoons in terms of complexity. The more complex and
- subtly rendered the image, the more likely that JPEG will do well on it.
- The same goes for semi-realistic artwork (fantasy drawings and such).
-
- JPEG has a hard time with very sharp edges: a row of pure-black pixels
- adjacent to a row of pure-white pixels, for example. Sharp edges tend to
- come out blurred unless you use a very high quality setting. Edges this
- sharp are rare in scanned photographs, but are fairly common in GIF files:
- borders, overlaid text, etc. The blurriness is particularly objectionable
- with text that's only a few pixels high. If you have a GIF with a lot of
- small-size overlaid text, don't JPEG it.
-
- Plain black-and-white (two level) images should never be converted to JPEG;
- they violate all of the conditions given above. You need at least about
- 16 gray levels before JPEG is useful for gray-scale images. It should also
- be noted that GIF is lossless for gray-scale images of up to 256 levels,
- while JPEG is not.
-
- If you have a large library of GIF images, you may want to save space by
- converting the GIFs to JPEG. This is trickier than it may seem --- even
- when the GIFs contain photographic images, they are actually very poor
- source material for JPEG, because the images have been color-reduced.
- Non-photographic images should generally be left in GIF form. Good-quality
- photographic GIFs can often be converted with no visible quality loss, but
- only if you know what you are doing and you take the time to work on each
- image individually. Otherwise you're likely to lose a lot of image quality
- or waste a lot of disk space ... quite possibly both. Read sections 7 and 8
- if you want to convert GIFs to JPEG.
-
-
- [4] How well does JPEG compress images?
-
- Very well indeed, when working with its intended type of image (photographs
- and suchlike). For full-color images, the uncompressed data is normally 24
- bits/pixel. The best known lossless compression methods can compress such
- data about 2:1 on average. JPEG can typically achieve 10:1 to 20:1
- compression without visible loss, bringing the effective storage requirement
- down to 1 to 2 bits/pixel. 30:1 to 50:1 compression is possible with small
- to moderate defects, while for very-low-quality purposes such as previews or
- archive indexes, 100:1 compression is quite feasible. An image compressed
- 100:1 with JPEG takes up the same space as a full-color one-tenth-scale
- thumbnail image, but it retains much more detail than such a thumbnail.
-
- For comparison, a GIF version of the same image would start out by
- sacrificing most of the color information to reduce the image to 256 colors
- (8 bits/pixel). This provides 3:1 compression. GIF has additional "LZW"
- compression built in, but LZW doesn't work very well on typical photographic
- data; at most you may get 5:1 compression overall, and it's not at all
- uncommon for LZW to be a net loss (less than 3:1 overall compression).
- When a JPEG file is made from full-color data, using a quality setting just
- high enough to prevent visible loss, the JPEG will typically be a factor of
- four or five smaller than a GIF file made from the same data.
-
- Gray-scale images do not compress by such large factors. Because the human
- eye is much more sensitive to brightness variations than to hue variations,
- JPEG can compress hue data more heavily than brightness (gray-scale) data.
- A gray-scale JPEG file is generally only about 10%-25% smaller than a
- full-color JPEG file of similar visual quality. But the uncompressed
- gray-scale data is only 8 bits/pixel, or one-third the size of the color
- data, so the calculated compression ratio is much lower. The threshold of
- visible loss is often around 5:1 compression for gray-scale images.
-
- The exact threshold at which errors become visible depends on your viewing
- conditions. The smaller an individual pixel, the harder it is to see an
- error; so errors are more visible on a computer screen (at maybe 70
- dots/inch) than on a high-quality color printout (300 or more dots/inch).
- Thus a higher-resolution image can tolerate more compression ... which is
- fortunate considering it's much bigger to start with. The numbers quoted
- above are typical for screen viewing. Also note that the threshold of
- visible error varies somewhat across images.
-
-
- [5] What are good "quality" settings for JPEG?
-
- Most JPEG compressors let you pick a file size vs. image quality tradeoff by
- selecting a quality setting. There seems to be widespread confusion about
- the meaning of these settings. "Quality 95" does NOT mean "keep 95% of the
- information", as some have claimed. The quality scale is purely arbitrary;
- it's not a percentage of anything.
-
- In fact, quality scales aren't even standardized across JPEG programs. The
- quality settings discussed in this article apply to the free JPEG software
- described in section 6B, and to many programs based on it. Other JPEG
- implementations, notably Apple's and HSI's, use completely different quality
- scales; for instance, Apple's scale covers 0-4, not 0-100. Some programs
- don't even provide a numeric scale, just "high"/"medium"/"low"-style
- choices. (Fortunately, this doesn't prevent different implementations from
- exchanging compressed files.)
-
- In most cases the user's goal is to pick the lowest quality setting, or
- smallest file size, that decompresses into an image indistinguishable from
- the original. This setting will vary from one image to another and from one
- observer to another, but here are some rules of thumb.
-
- For good-quality, full-color source images, the default quality setting
- (Q 75) is very often the best choice. This setting is about the lowest you
- can go without expecting to see defects in a typical image. Try Q 75 first;
- if you see defects, then go up.
-
- If the image was less than perfect quality to begin with, you might be able
- to drop down to Q 50 without objectionable degradation. On the other hand,
- you might need to go to a *higher* quality setting to avoid further loss.
- Q 85 to 95 is often best for converting GIFs (see section 8 for more info).
-
- Except for experimental purposes, never go above about Q 95; using Q 100
- will produce a file two or three times as large as Q 95, but of hardly any
- better quality. If you see a file made with Q 100, it's a pretty sure sign
- that the maker didn't know what he/she was doing.
-
- If you want a very small file (say for preview or indexing purposes) and are
- prepared to tolerate large defects, a Q setting in the range of 5 to 10 is
- about right. Q 2 or so may be amusing as "op art".
-
-
- [6] Where can I get JPEG software?
-
- Most of the programs described in this section are available by FTP.
- If you don't know how to use FTP, see the FAQ article "How to find sources".
- (If you don't have direct access to FTP, read about ftpmail servers in the
- same article.) That article appears regularly in news.answers, or you can
- get it by sending e-mail to mail-server@rtfm.mit.edu with
- "send usenet/news.answers/finding-sources" in the body. The "Anonymous FTP
- List FAQ" may also be helpful --- it's usenet/news.answers/ftp-list/faq in
- the news.answers archive.
-
- NOTE: this list changes frequently. If you have a copy more than a couple
- months old, get the latest JPEG FAQ from the news.answers archive.
-
-
- [6A] If you are looking for viewers, application programs, etc:
-
- This section covers programs for the following kinds of systems:
- X Windows, MS-DOS, Microsoft Windows, OS/2, Macintosh,
- Amiga, Atari ST, Acorn Archimedes, NeXT.
- If you don't see what you want for your machine, check out the free JPEG
- source code described in section 6B. Assuming you have a C compiler and at
- least a little knowledge of compiling C programs, you should be able to
- prepare JPEG conversion programs from the source code. You'll also need a
- viewer program. If your display is 8 bits or less, any GIF viewer will do
- fine; if you have a display with more color capability, try to find a viewer
- that can read Targa or PPM 24-bit image files.
-
- Note that this list concentrates on free and shareware programs that you can
- obtain over Internet; but some commercial programs are listed too. If you
- choose a commercial JPEG product, make sure that it can handle the Usenet-
- standard JFIF file format, or you won't be able to exchange images with
- anyone else. (See section 10 if you want to know more about file formats.)
-
-
- X Windows:
-
- XV (shareware, $25) is an excellent viewer for JPEG, GIF, and many other
- image formats. It can also do format conversion and some simple image
- manipulations. It's available for FTP from export.lcs.mit.edu (18.24.0.12),
- file contrib/xv-3.00.tar.Z. Version 3.00 is a major upgrade with support
- for 24-bit displays and many other improvements; however, it is brand new
- and still has some bugs lurking. If you prefer not to be on the bleeding
- edge, stick with version 2.21, also available from export. Note that
- version 2.21 is not a good choice if you have a 24-bit display (you'll get
- only 8-bit color), nor is it good for converting 24-bit images to JPEG.
- But 2.21 works fine for converting GIF and other 8-bit images to JPEG.
- CAUTION: with version 2.21, be sure to check the "save at normal size"
- checkbox when saving a JPEG file, or the file will be blurry.
-
- Another good choice for X Windows is John Cristy's free ImageMagick package,
- also available from export.lcs.mit.edu, file contrib/ImageMagick.tar.Z.
- This package handles many image processing and conversion tasks. The
- ImageMagick viewer handles 24-bit displays correctly; for colormapped
- displays, it does better (though slower) color quantization than XV or the
- basic free JPEG software. The current version is 2.3.2.
-
- Both of the above are large, complex packages. If you just want a simple
- image viewer, try xloadimage or xli. xloadimage supports JPEG in its latest
- release, 3.03. xloadimage is free and available from export.lcs.mit.edu,
- file contrib/xloadimage-3.03.tar.Z. xli is a variant version of xloadimage,
- said by its fans to be somewhat faster and more robust than the original.
- (The current xli is indeed faster and more robust than the current
- xloadimage with respect to JPEG files, because it uses the v4 IJG decoder
- while xloadimage 3.03 is still using a hacked-over v1. The next xloadimage
- release will fix this.) xli is also free and available from
- export.lcs.mit.edu, file contrib/xli.1.14.tar.Z. Both programs are said to
- do the right thing with 24-bit displays.
-
- MS-DOS:
-
- This covers plain DOS; for Windows or OS/2 programs, see the next headings.
-
- One good choice is Eric Praetzel's free DVPEG, which views JPEG and GIF files.
- The current version, 2.5, is available by FTP from sunee.uwaterloo.ca
- (129.97.50.50), file pub/jpeg/viewers/dvpeg25.zip. This is a good basic
- viewer that works on either 286 or 386/486 machines. The user interface is
- not flashy, but it's functional.
-
- Another freeware JPEG/GIF/TGA viewer is Mohammad Rezaei's Hiview. The
- current version, 1.2, is available from Simtel20 and mirror sites (see NOTE
- below), file msdos/graphics/hv12.zip. Hiview requires a 386 or better CPU
- and a VCPI-compatible memory manager (QEMM386 and 386MAX work; Windows and
- OS/2 do not). Hiview is currently the fastest DOS viewer for images that
- are no bigger than your screen. For larger images, it scales the image down
- to fit on the screen (rather than using panning/scrolling as most viewers
- do). You may or may not prefer this approach, but there's no denying that
- it slows down loading of large images considerably. Note: installation is a
- bit tricky; read the directions carefully!
-
- A shareware alternative is ColorView for DOS ($30). This is easier to
- install than either of the two freeware alternatives. Its user interface is
- also much spiffier-looking, although personally I find it harder to use ---
- more keystrokes, inconsistent behavior. It is faster than DVPEG but a
- little slower than Hiview, at least on my hardware. (For images larger than
- screen size, DVPEG and ColorView seem to be about the same speed, and both
- are faster than Hiview.) The current version is 2.1, available from
- Simtel20 and mirror sites (see NOTE below), file msdos/graphics/dcview21.zip.
- Requires a VESA graphics driver; if you don't have one, look in vesadrv2.zip
- or vesa-tsr.zip from the same directory. (Some recent PCs have a built-in
- VESA driver, so don't try to load a VESA driver unless ColorView complains
- that the driver is missing.)
-
- A second shareware alternative is Fullview, which has been kicking around
- the net for a while, but I don't know any stable archive location for it.
- The current (rather old) version is inferior to the above viewers anyway.
- The author tells me that a new version of Fullview will be out shortly
- and it will be submitted to the Simtel20 archives at that time.
-
- The well-known GIF viewer CompuShow (CSHOW) supports JPEG in its latest
- revision, 8.60a. However, CSHOW's JPEG implementation isn't very good:
- it's slow (about half the speed of the above viewers) and image quality is
- poor except on hi-color displays. Too bad ... it'd have been nice to see a
- good JPEG capability in CSHOW. Shareware, $25. Available from Simtel20 and
- mirror sites (see NOTE below), file msdos/gif/cshw860a.zip.
-
- Due to the remarkable variety of PC graphics hardware, any one of these
- viewers might not work on your particular machine. If you can't get *any*
- of them to work, you'll need to use one of the following conversion programs
- to convert JPEG to GIF, then view with your favorite GIF viewer. (If you
- have hi-color hardware, don't use GIF as the intermediate format; try to
- find a TARGA-capable viewer instead. VPIC5.0 is reputed to do the right
- thing with hi-color displays.)
-
- The Independent JPEG Group's free JPEG converters are available from
- Simtel20 and mirror sites (see NOTE below), file msdos/graphics/jpeg4.zip
- (or jpeg4386.zip if you have a 386 and extended memory). These files are
- DOS compilations of the free source code described in section 6B; they will
- convert JPEG to and from GIF, Targa, and PPM formats.
-
- Handmade Software offers free JPEG<=>GIF conversion tools, GIF2JPG/JPG2GIF.
- These are slow and are limited to conversion to and from GIF format; in
- particular, you can't get 24-bit color output from a JPEG. The major
- advantage of these tools is that they will read and write HSI's proprietary
- JPEG format as well as the Usenet-standard JFIF format. Since HSI-format
- files are rather widespread on BBSes, this is a useful capability. Version
- 2.0 of these tools is free (prior versions were shareware). Get it from
- Simtel20 and mirror sites (see NOTE below), file msdos/graphics/gif2jpg2.zip.
- NOTE: do not use HSI format for files to be posted on Usenet, since it is
- not readable on non-PC platforms.
-
- Handmade Software also has a shareware image conversion and manipulation
- package, Image Alchemy. This will translate JPEG files (both JFIF and HSI
- formats) to and from many other image formats. It can also display images.
- A demo version of Image Alchemy version 1.6.2 is available from Simtel20 and
- mirror sites (see NOTE below), file msdos/graphics/alch162.zip.
-
- JPGINDEX is a useful tool for making indexes of JPEG image collections.
- Available from Simtel20 and mirror sites, file msdos/graphics/jpgidx13.zip.
-
- NOTE ABOUT SIMTEL20: The Internet's key archive site for PC-related programs
- is Simtel20, full name wsmr-simtel20.army.mil (192.88.110.20). Simtel20
- runs a non-Unix system with weird directory names; where this document
- refers to directory (eg) "msdos/graphics" at Simtel20, that really means
- "pd1:<msdos.graphics>". If you are not physically on MILnet, you should
- expect rather slow FTP transfer rates from Simtel20. There are several
- Internet sites that maintain copies (mirrors) of the Simtel20 archives;
- most FTP users should go to one of the mirror sites instead. A popular USA
- mirror site is oak.oakland.edu (141.210.10.117), which keeps Simtel20 files
- in (eg) "/pub/msdos/graphics". If you have no FTP capability, you can
- retrieve files from Simtel20 by e-mail; see informational postings in
- comp.archives.msdos.announce to find out how. If you are outside the USA,
- consult the same newsgroup to learn where your nearest Simtel20 mirror is.
-
- Microsoft Windows:
-
- Windows viewers are slower than comparable DOS viewers on the same hardware,
- due to Windows' system overhead.
-
- The newest entry is WinECJ, which is free and EXTREMELY fast. Version 1.1
- is available from Simtel20 and mirror sites (see NOTE above), file
- msdos/windows3/winecj11.zip. Requires Windows 3.1 and 256-or-more-colors
- mode. This is a no-frills viewer with image quality noticeably worse than
- most other JPEG viewers. But it's so fast you'll use it anyway, at least
- for previewing. (Image quality is not a problem if you have a 24-bit
- display. Also, you can purchase a version with better 8-bit image quality
- for AUD$30.)
-
- JView is freeware, has good on-line help, and can write out the decompressed
- image in Windows BMP format; but it's not fast by current standards, and it
- doesn't view GIFs. JView also lacks some other useful features such as
- brightness adjustment, but it's still a good basic viewer. The current
- version, 0.9, is available from ftp.cica.indiana.edu (129.79.20.84), file
- pub/pc/win3/desktop/jview090.zip. (Mirrors of this archive can be found at
- some other Internet sites, including wuarchive.wustl.edu.)
-
- WinJPEG (shareware, $20) displays JPEG,GIF,Targa,TIFF,PCX, and BMP files;
- it can write all of these formats too, so it can be used as a converter.
- It has some other nifty features including color-balance adjustment and
- slideshow. The current version is 2.2, available from Simtel20 and mirror
- sites (see NOTE above), file msdos/windows3/winjp220.zip. (This is a
- 286-compatible version; if you register, you'll get the 386-only version,
- which is roughly 25% faster.)
-
- ColorView is another shareware entry ($30). This was an early and promising
- contender, but it has not been updated in some time, and at this point it
- has no notable advantages over WinJPEG. If you want to try it anyway, the
- current version is 0.97, available from ftp.cica.indiana.edu, file
- pub/pc/win3/desktop/cview097.zip. (I understand that a new version will be
- appearing once the authors are finished with ColorView for DOS.)
-
- DVPEG (see DOS heading) works under Windows, but only in full-screen mode,
- not in a window. Also note that you can run the DOS conversion programs
- described above inside a Windows DOS window.
-
- OS/2:
-
- The following files are available from hobbes.nmsu.edu (128.123.35.151).
- Note: check /pub/uploads for more recent versions --- the hobbes moderator
- is not very fast about moving uploads into their permanent directories.
-
- /pub/os2/2.x/graphics/jpegv4.zip
- 32-bit version of free IJG conversion programs, version 4.
- /pub/os2/all/graphics/jpeg4-16.zip
- 16-bit version of same, for OS/2 1.x.
- /pub/os2/2.x/graphics/imgarc13.zip
- Image Archiver 1.03: image conversion/viewing with PM graphical interface.
- Strong on conversion functions, viewing is a bit weaker. Shareware, $15.
- /pub/os2/2.x/graphics/pmjpeg13.zip
- PMJPEG 1.3: OS/2 2.x port of WinJPEG, a popular viewer for Windows
- (see description in Windows section). Shareware, $20.
- /pub/os2/2.x/graphics/pmview85.zip
- PMView 0.85: JPEG/GIF/BMP/Targa/PCX viewer. GIF viewing very fast,
- JPEG viewing roughly the same speed as the above two programs. Has
- image manipulation & slideshow functions. Shareware, $20.
-
- Also worth trying is JoeView, a free JPEG/GIF/BMP viewer. Version 1.1f is
- available from bill_the_cat.nosc.mil (128.49.60.4), file joeview.zip.
-
- Macintosh:
-
- Most Mac JPEG programs rely on Apple's JPEG implementation, which is part of
- the QuickTime system extension; so you need to have QuickTime installed.
- To use QuickTime, you need a 68020 or better CPU and you need to be running
- System 6.0.7 or later. (If you're running System 6, you must also install
- the 32-bit QuickDraw extension; this is built-in on System 7.) The latest
- version of QuickTime is 1.6, available by FTP from ftp.apple.com, file
- dts/mac/sys.soft/quicktime/quicktime.hqx (get the other files in that
- directory too!). Quite a few compatibility problems have been reported with
- 1.6, so don't trash your copy of 1.5 until you've checked it out...
-
- Mac users should keep in mind that QuickTime's JPEG format, PICT/JPEG, is
- not the same as the Usenet-standard JFIF JPEG format. (See section 10 for
- details.) If you post images on Usenet, make sure they are in JFIF format.
- Most of the programs mentioned here can handle either format.
-
- The first choice is probably JPEGView, a free program for viewing images
- that are in JFIF format, PICT/JPEG format, or GIF format. It also can
- convert between the two JPEG formats. The current version is 2.0, available
- from sumex-aim.stanford.edu (36.44.0.6), file info-mac/app/jpeg-view-20.hqx.
- Requires System 7 and QuickTime. On 8-bit displays, JPEGView usually
- produces the best color image quality of all the currently available Mac
- JPEG viewers. JPEGView can view large images in much less memory than other
- Mac viewers; in fact, it's the only one that can deal with JPEG images much
- over 640x480 pixels on a typical 4MB Mac. Given a large image, JPEGView
- automatically scales it down to fit on the screen, rather than presenting
- scroll bars like most other viewers. (You can zoom in on any desired
- portion, though.) Some people like this behavior, some don't. Overall,
- JPEGView's user interface is very well thought out.
-
- GIFConverter, a shareware ($40) image viewer/converter, supports JFIF and
- PICT/JPEG, as well as GIF and several other image formats. The latest
- version is 2.3.2. Get it from sumex-aim.stanford.edu, file
- /info-mac/art/gif/gif-converter-232.hqx. Requires System 6.0.5 or later.
- GIFConverter is not better than JPEGView as a plain JPEG/GIF viewer, but
- it has much more extensive image manipulation and format conversion
- capabilities, so you may find it worth its shareware fee if you do a lot of
- playing around with images. Also, the newest version of GIFConverter can
- load and save JFIF images *without* QuickTime, so it is your best bet if
- your machine is too old to run QuickTime. (But it's faster with QuickTime.)
- Note: If GIFConverter runs out of memory trying to load a large JPEG, try
- converting the file to GIF with JPEG Convert, then viewing the GIF version.
-
- JPEG Convert, a Mac version of the free IJG JPEG conversion utilities, is
- available from sumex-aim.stanford.edu, file info-mac/app/jpeg-convert-10.hqx.
- This will run on any Mac, but it only does file conversion, not viewing.
- You can use it in conjunction with any GIF viewer.
-
- Previous versions of this FAQ recommended Imagery JPEG v0.6, a JPEG<=>GIF
- converter based on an old version of the IJG code. If you are using this
- program, you definitely should replace it with JPEG Convert.
-
- Apple has a free but unsupported program called PictPixie, which can view
- images in JFIF, PICT/JPEG, and GIF formats, and can convert between these
- formats. Unfortunately PictPixie doesn't work with QuickTime 1.6, and it
- has a bunch of other drawbacks as well. If you want it, you can get it from
- ftp.apple.com, file dts/mac/quicktime/qt.1.0.stuff/pictpixie.hqx. (There is
- an old version of PictPixie, called PICTCompressor, floating around the net.
- If you have this you should trash it and get something less buggy. Also,
- the QuickTime Starter Kit includes a much cleaned-up descendant of PictPixie
- called Picture Compressor. Note that Picture Compressor is NOT free.)
-
- Storm Technology's Picture Decompress is a free JPEG viewer/converter.
- This rather old program is inferior to the above programs in many ways, but
- it will run without System pay for GIFConverter, use JPEG Convert and a free GIF viewer.
-
- More and more commercial Mac applications are supporting JPEG, although not
- all can deal with the Usenet-standard JFIF format. Adobe Photoshop, version
- 2.0.1 or later, can read and write JFIF-format JPEG files (use the JPEG
- plug-in from the Acquire menu). You must set the file type of a downloaded
- JPEG file to 'JPEG' to allow Photoshop to recognize it.
-
- Amiga:
-
- Most programs listed in this section are stored in the AmiNet archive at
- amiga.physik.unizh.ch (130.60.80.80). There are many mirror sites of this
- archive and you should try to use the closest one. In the USA, a good
- choice is wuarchive.wustl.edu; look under /mirrors/amiga.physik.unizh.ch/...
-
- HamLab Plus is an excellent JPEG viewer/converter, as well as being a
- general image manipulation tool. It's cheap (shareware, $20) and can read
- several formats besides JPEG. The current version is 2.0.8. A demo version
- is available from amiga.physik.unizh.ch (and mirror sites), file
- amiga/gfx/edit/hamlab208d.lha. The demo version will crop images larger
- than 512x512, but it is otherwise fully functional.
-
- Rend24 (shareware, $30)mes on-the-fly from rendering packages like Lightwave. The
- current version is 1.05, available from amiga.physik.unizh.ch (and mirror
- sites), file amiga/os30/gfx/rend105.lha. (Note: although this directory is
- supposedly for AmigaDOS 3.0 programs, the program will also run under
- AmigaDOS 1.3, 2.04 or 2.1.)
-
- Viewtek is a free JPEG/ILBM/GIF/ANIM viewer. The current version is 1.04,
- available from amiga.physik.unizh.ch (and mirror sites), file
- amiga/gfx/show/ViewTek104.lha.
-
- If you're willing to spend real money, there are several commercial packages
- that support JPEG. Two are written by Thomas Krehbiel, the author of Rend24
- and Viewtek. These are CineMorph, a standalone image morphing package, and
- ImageFX, an impressive 24-bit image capture, conversion, editing, painting,
- effects and prepress package that also includes CineMorph. Both are
- distributed by Great Valley Products. Art Department Professional (ADPro),
- from ASDG Inc, is the most widely used commercial image manipulation
- software for Amigas. ImageMaster, from Black Belt Systems, is another
- well-regarded commercial graphics package with JPEG support.
-
- The free IJG JPEG software is available compiled for Amigas from
- amiga.physik.unizh.ch (and mirror sites) in directory amiga/gfx/conv, file
- AmigaJPEGV4.lha. These programs convert JPEG to/from PPM,GIF,Targa formats.
-
- The Amiga world is heavily infested with quick-and-dirty JPEG programs, many
- based on an ancient beta-test version of the free IJG JPEG software (thanks
- to a certain magazine that published same on its disk-of-the-month, without
- so much as notifying the authors). Among these are "AugJPEG", "NewAmyJPEG",
- "VJPEG", and probably others I have not even heard of. In my opinion,
- anything older than IJG version 3 (March 1992) is not worth the disk space
- it's stored on; if you have such a program, trash it and get something newer.
-
- Atari ST:
-
- The free IJG JPEG software is available compiled for Atari ST, TT, etc,
- from atari.archive.umich.edu, file /atari/Graphics/jpeg4bin.zoo.
- These programs convert JPEG to/from PPM, GIF, Targa formae.umich.edu, file /atari/Graphics/mgif41b.zoo.
-
- I have not heard of any other free or shareware JPEG-capable viewers for
- Ataris, but surely there must be some by now? Pointers appreciated.
-
- Acorn Archimedes:
-
- !ChangeFSI, supplied with RISC OS 3 version 3.10, can convert from and view
- JPEG JFIF format. Provision is also made to convert images to JPEG,
- although this must be done from the CLI rather than by double-clicking.
-
- Recent versions (since 7.11) of the shareware program Translator can handle
- JPEG, along with about 30 other image formats. While older versions can be
- found on some Archimedes bboards, the current version is only available by
- registering with the author, John Kortink, Nutterbrink 31, 7544 WJ, Enschede,
- The Netherlands. Price 35 Dutch guilders (about $22 or 10 pounds).
-
- There's also a commercial product called !JPEG which provides JPEG read/write
- functionality and direct JPEG viewing, as well as a host of other image
- format conversion and processing options. This is more expensive but not
- necessarily better than the above programs. Contact: DT Software, FREEPOST,
- Cambridge, UK. Tel: 0223 841099.
-
- NeXT:
-
- ImageViewer is a PD utility that displays images and can do some format
- conversions. The current version reads JPEG but does not write it.
- ImageViewer is available from the standard NeXT archives at
- sonata.cc.purdue.edu and cs.orst.edu, somewhere in /pub/next (both are
- currently being re-organized, so it's hard to point to specific
- sub-directories). Note that there is an older version floating around that
- does not support JPEG.
-
- NeXTStep includes built-in support for TIFF/JPEG, but not for the
- Usenet-standard JFIF format.
-
-
- [6B] If you are looking for source code to work with:
-
- Free, portable C code for JPEG compression is available from the Independent
- JPEG Group, which I lead. A package containing our source code,
- documentation, and some small test files is available from ftp.uu.net
- (192.48.96.9) in directory /graphics/jpeg. The current release is v4, file
- jpegsrc.v4.tar.Z. (This is a compressed TAR file; don't forget to retrieve
- in binary mode.) You can retrieve this file by FTP or UUCP. Copies can
- also be found at many other Internet sites. If you are on a PC and don't
- know how to cope with .tar.Z format, you may prefer ZIP format, which you
- can find at Simtel20 and mirror sites (see NOTE above), file
- msdos/graphics/jpegsrc4.zip. This file is also available on CompuServe, in
- the GRAPHSUPPORT forum (GO PICS), library 15, as jpsrc4.zip. If you have no
- FTP access, you can retrieve the source from your nearest comp.sources.misc
- archive; version 4 appeared as issues 55-72 of volume 34. (If you don't
- know how to retrieve comp.sources.misc postings, see the FAQ article "How to
- find sources", referred to at the top of section 6.)
-
- The free JPEG code provides conversion between JPEG "JFIF" format and image
- files in GIF, PBMPLUS PPM/PGM, Utah RLE, and Truevision Targa file formats.
- The core compression and decompression modules can easily be reused in other
- programs, such as image viewers. The package is highly portable; we have
- tested it on many machines ranging from PCs to Crays.
-
- We have released this software for both noncommercial and commercial use.
- Companies are welcome to use it as the basis for JPEG-related products.
- We do not ask a royalty, although we do ask for an acknowledgement in
- product literature (see the README file in the distribution for details).
- We hope to make this software industrial-quality --- although, as with
- anything that's free, we offer no warranty and accept no liability.
-
- The Independent JPEG Group is a volunteer organization; if you'd like to
- contribute to improving our software, you are welcome to join.
-
-
- [7] What's all this hoopla about color quantization?
-
- Most people don't have full-color (24 bit per pixel) display hardware.
- Typical display hardware stores 8 or fewer bits per pixel, so it can display
- 256 or fewer distinct colors at a time. To display a full-color image, the
- computer must choose an appropriate set of representative colors and map the
- image into these colors. This process is called "color quantization".
- (This is something of a misnomer; "color selection" or "color reduction"
- would be a better term. We're stuck with the standard usage though.)
-
- Clearly, color quantization is a lossy process. It turns out that for most
- images, the details of the color quantization algorithm have *much* more
- impact on the final image quality than do any errors introduced by JPEG
- itself (except at the very lowest JPEG quality settings). Making a good
- color quantization algorithm is a black art, and no single algorithm is best
- for all images.
-
- Since JPEG is a full-color format, converting a color JPEG image for display
- on 8-bit-or-less hardware requires color quantization. The speed and image
- quality of a JPEG viewer running on such hardware are largely determined by
- its quantization algorithm. You'll see great variation in image quality
- among viewers on 8-bit displays, much more than occurs on 24-bit displays.
-
- On the other hand, a GIF image has already been quantized to 256 or fewer
- colors. (A GIF *does* have a specific number of colors in its palette, and
- the format doesn't allow more than 256 palette entries.) GIF has the
- advantage that the image maker precomputes the color quantization, so
- viewers don't have to; this is one of the things that make GIF viewers
- faster than JPEG viewers. But this is also the *disadvantage* of GIF:
- you're stuck with the maker's quantization. If the maker quantized to a
- different number of colors than what you can display, you'll either waste
- display capability or have to quantize again to further reduce the number of
- colors (which results in much poorer image quality than if you had quantized
- once from a full-color image). Furthermore, if the maker didn't use a
- high-quality color quantization algorithm, you're out of luck --- the image
- is ruined.
-
- For this reason, JPEG promises significantly better image quality than GIF
- for all users whose machines don't match the image maker's display hardware.
- JPEG's full color image can be quantized to precisely match the viewer's
- display hardware. Furthermore, you will be able to take advantage of future
- improvements in quantization algorithms (there is a lot of active research
- in this area), or purchase better display hardware, to get a better view of
- JPEG images you already have. With a GIF, you're stuck forevermore with
- what was sent.
-
- A growing number of people have better-than-8-bit display hardware already:
- 15-bit "hi-color" PC displays, true 24-bit displays on workstations and
- Macintoshes, etc. For these people, GIF is already obsolete, as it cannot
- represent an image to the full capabilities of their display. JPEG images
- can drive these displays much more effectively.
-
- In short, JPEG is an all-around better choice than GIF for representing
- images in a machine-independent fashion.
-
-
- It's sometimes thought that a JPEG converted from a GIF shouldn't require
- color quantization. This is false: even when you feed a 256-or-less-color
- GIF into JPEG, what comes out of the decompressor is not 256 colors, but
- thousands of colors. This happens because JPEG's lossiness affects each
- pixel a little differently, so two pixels that started with identical colors
- will usually come out with slightly different colors. Each original color
- gets "smeared" into a group of nearby colors. Therefore quantization is
- always required to display a color JPEG on a colormapped display, regardless
- of the image source.
-
- The same effect makes it nearly meaningless to talk about the number of
- colors used by a JPEG image. Even if you were to count the number of
- distinct pixel values, different JPEG decoders would give you different
- results because of roundoff error differences. I occasionally see posted
- images described as "256-color JPEG". This tells me that the poster
- (a) hasn't read this FAQ and (b) probably converted the JPEG from a GIF.
- JPEGs can be classified as color or gray-scale, but number of colors just
- isn't a useful concept for JPEG, any more than it is for a real photograph.
-
-
- [8] What are some rules of thumb for converting GIF images to JPEG?
-
- Converting GIF files to JPEG is a tricky business -ropriate for JPEG
- (see section 3 about that). Large, high-visual-quality photographic images
- are usually the best material. And they take up lots of space in GIF form,
- so they offer significant potential space savings. (A good rule of thumb is
- not to bother converting any GIF that's much under 100 Kbytes; the potential
- space savings isn't worth the hassle.)
-
- The second rule is to look at each JPEG, to make sure you are happy with it,
- before throwing away the corresponding GIF; this will give you a chance to
- re-do the conversion with a higher quality setting if necessary. Also
- compare the file sizes --- if the image isn't suitable JPEG material, a JPEG
- file of reasonable quality may come out *larger* than the GIF.
-
- The third rule is to get rid of the border. Many people have developed
- an odd habit of putting a large single-color border around a GIF image.
- While useless, this is nearly free in terms of storage cost in GIF files.
- It is NOT free in JPEG files, either in storage space or in decoding time;
- and the sharp border boundary can create visible artifacts ("ghost" edges).
- Furthermore, when viewing a bordered JPEG on an 8-bit display, the quantizer
- will think the border color is important because there's so much of it, and
- hence will waste color palette entries on the border, thus actually reducing
- the displayed quality of the main part of the image! So do yourself a favor
- and crop off any border before JPEGing.
-
- Gray-scale images usually convert without much problem. When using cjpeg,
- be sure to specify -gray. (By default, cjpeg treats GIFs as color files;
- this works but wastes space and time for gray-scale data.) Quality settings
- around the default (75) are usually fine.
-
- Color images are much trickier. Color GIFs of photographic images are
- usually "dithered" to fool your eye into seeing more than the 256 colors
- that GIF can actually store. If you enlarge the image, you will find that
- adjacent pixels are often of significantly different colors; at normal size
- the eye averages these pixels together to produce the illusion of an
- intermediate color value. The trouble with dithering is that, to JPEG, it
- looks like high-spatial-frequency color noise; and JPEG can't compress noise
- very well. The resulting JPEG file is both larger and of lower image
- quality than what you would have gotten from JPEGing the original full color
- image (if you had it). To get around this, you need to "smooth" the GIF
- image before compression. Smoothing averages together nearby pixels, thus
- approximating the color that you thought you saw anyway, and in the process
- getting rid of the rapid color changes that give JPEG trouble. Proper use
- of smoothing will both reduce the size of the compressed file and give you a
- better-looking output image than you'd get without smoothing.
-
- With the V4 free JPEG softwse without ruining the image, and this noise wastes space.
- Typically, a good-quality converted JPEG will be 1/2 to 1/3rd the size of
- the GIF file, not 1/4th as suggested in section 4. (If the JPEG comes out
- much more than half the size of the GIF, this is a good sign that the image
- shouldn't be converted at all.)
-
- The upshot of all this is that "cjpeg -quality 85 -smooth 10" is probably a
- good starting point for converting color GIFs. But if you care about the
- image, you'll want to check the results and maybe try a few other settings.
- Blindly converting a large GIF library at this or any other setting is a
- recipe for disaster.
-
-
- [9] Does loss accumulate with repeated compression/decompression?
-
- It would be nice if, having compressed an image with JPEG, you could
- decompress it, manipulate it (crop off a border, say), and recompress it
- without any further image degradation beyond what you lost initially.
- Unfortunately THIS IS NOT THE CASE. In general, recompressing an altered
- image loses more information. Hence it's important to minimize the number
- of generations of JPEG compression between initial and final versions of an
- image.
-
- It turns out that if you decompress and recompress an image at the same
- quality setting first used, little or no further degradation occurs.
- (Counterintuitively, this works better the lower the quality setting.
- But you must use *exactly* the same setting, or all bets are off.)
- This means that you can make local modifications to an image without
- material degradation of other areas of the image. Unfortunately, cropping
- doesn't count as a local change! JPEG processes the image in small blocks,
- and cropping usually moves the block boundaries, so that the image looks
- completely different to JPEG. You can take advantage of the low-degradation
- behavior if you are careful to crop the top and left margins only by a
- multiple of the block size (typically 16 pixels), so that the remaining
- blocks start in the same places.
-
- The bottom line is that JPEG is a useful format for archival storage and
- transmission of images, but you don't want to use it as an intermediate
- format for sequences of image manipulation steps. Use a lossless format
- (PPM, RLE, TIFF, etc) while working on the image, then JPEG it when you are
- ready to file it away. Aside from avoiding degradation, you will save a lot
- of compression/decompression time this way :-).
-
-
- [10] Why all the argument about file formats?
-
- Strictly speaking, JPEG refers only to a family of compression algorithms;
- it does *not* refer to a specific image file format. The JPEG committee was
- prevented from defining a file format by turf wars within the international
- standards organizations.
-
- Since we can't actually exchange images with anyone else unless we agree on
- a common file format, this leaves us with a problem. In the absence of
- official standards, a number of JPEG program writers have just gone off to
- "do their own thing", and as a result their programs aren't compatible with
- anybody else's.
-
- The closest thing we have to a standard JPEG format is some work that's been
- coordinated by people at C-Cube Microsystems. They have defined two
- JPEG-based file formats:
- * JFIF (JPEG File Interchange Format), a "low-end" format that transports
- pixels and not much else.
- * TIFF/JPEG, aka TIFF 6.0, an extension of the Aldus TIFF format. TIFF is
- a "high-end" format that will let you record just about everything you
- ever wanted to know about an image, and a lot more besides :-). TIFF is
- a lot more complex than JFIF, and is generally less transportable,
- because different vendors have often implemented slightly different
- and incompatible subsets of TIFF. It's not likely that adding JPEG to
- the mix will do anything to improve this situation.
- Both of these formats were developed with input from all the major vendors
- of JPEG-related products; it's reasonably likely that future commercial
- products will adhere to one or both standards.
-
- JFIF has emerged as the de-facto standard on Usenet. JFIF is simpler than
- TIFF and is available now; the TIFF 6.0 spec has only recently been
- officially adopted, and it is still unusably vague on some crucial details.
- Even when TIFF/JPEG is well defined, the JFIF format is likely to be a
- widely supported "lowest common denominator"; TIFF/JPEG files may never be
- as transportable.
-
- A particular case of interest is Apple's Macintosh QuickTime software.
- QuickTime uses a JFIF-compatible format wrapped inside the Mac-specific PICT
- structure. Conversion between JFIF and PICT/JPEG is pretty straightforward,
- and several Mac programs are available to do it (see Mac portion of section
- 6A). If you have an editor that handles binary files, you can strip a
- PICT/JPEG file down to JFIF by hand; see section 11 for details.
-
- Another particular case is Handmade Software's programs (GIF2JPG/JPG2GIF and
- Image Alchemy). These programs are capable of reading and writing JFIF
- format. By default, though, they write a proprietary format developed by
- HSI. This format is NOT readable by any non-HSI programs and should not be
- used for Usenet postings. Use the -j switch to get JFIF output. (This
- applies to old versions of these programs; the current releases emit JFIF
- format by default. You still should be careful not to post HSI-format
- files, unless you want to get flamed by people on non-PC platforms.)
-
-
- [11] How do I recognize which file format I have, and what do I do about it?
-
- If you have an alleged JPEG file that your software won't read, it's likely
- to be HSI format or some other proprietary JPEG-based format. You can tell
- what you have by inspecting the first few bytes of the file:
-
- 1. A JFIF-standard file will start with the characters (hex) FF D8 FF E0,
- followed by two variable bytes (often hex 00 10), followed by 'JFIF'.
-
- 2. If you see FF D8 at the start, but not the rest of it, you may have a
- "raw JPEG" file. This is probably decodable as-is by JFIF software ---
- it's worth a try, anyway.
-
- 3. HSI files start with 'hsi1'. You're out of luck unless you have HSI
- software. Portions of the file may look like plain JPEG data, but they
- won't decompress properly with non-HSI programs.
-
- 4. A Macintosh PICT file, if JPEG-compressed, will have a couple hundred
- bytes of header followed by a JFIF header (scan for 'JFIF'). Strip off
- everything before the FF D8 and you should be able to read it.
-
- 5. Anything else: it's a proprietary format, or not JPEG at all. If you are
- lucky, the file may consist of a header and a raw JPEG data stream.
- If you can identify the start of the JPEG data stream (look for FF D8),
- try stripping off everything before that.
-
- In uuencoded Usenet postings, the characteristic JFIF pattern is
-
- "begin" line
- M_]C_X ...
-
- whereas uuencoded HSI files will start with
-
- "begin" line
- M:'-I ...
-
- If you learn to check for the former, you can save yourself the trouble of
- downloading non-JFIF st nothing in common with the regular, lossy JPEG
- algorithm, and it offers much less compression. At present, very few
- implementations of lossless JPEG exist, and all of them are commercial.
-
- Saying "-quality 100" to the free JPEG software DOES NOT get you a lossless
- image. What it does get rid of is deliberate information loss in the
- coefficient quantization step. There is still a good deal of information
- loss in the color subsampling step. (With the V4 free JPEG code, you can
- also say "-sample 1x1" to turn off subsampling. Keep in mind that some
- commercial JPEG implementations cannot cope with the resulting file.)
-
- Even with both quantization and subsampling turned off, the regular JPEG
- algorithm is not lossless, because it is subject to roundoff errors in
- various calculations. The maximum error is a few counts in any one pixel
- value; it's highly unlikely that this could be perceived by the human eye,
- but the error will accumulate to become visible if you put the image through
- multiple cycles of compression.
-
- At this minimum-loss setting, regular JPEG produces files that are perhaps
- half the size of an uncompressed 24-bit-per-pixel image. True lossless JPEG
- provides roughly the same amount of compression, but it guarantees
- bit-for-bit accuracy.
-
- If you have an application requiring lossless storage of images with less
- than 6 bits per pixel (per color component), you may want to look into the
- JBIG bilevel image compression standard. This performs better than JPEG
- lossless on such images. JPEG lossless is superior to JBIG on images with
- 6 or more bits per pixel; furthermore, JPEG is public domain (at least with a
- Huffman back end), while the JBIG techniques are heavily covered by patents.
-
-
- [14] What about arithmetic coding?
-
- The JPEG spec defines two different "back end" modules for the final output
- of compressed data: either Huffman coding or arithmetic coding is allowed.
- The choice has no impact on image quality, but arithmetic coding usually
- produces a smaller compressed file. On typical images, arithmetic coding
- produces a file 5 or 10 percent smaller than Huffman coding. (All the
- file-size numbers previously cited are for Huffman coding.)
-
- Unfortunately, the particular variant of arithmetic coding specified by the
- JPEG standard is subject to patents owned by IBM, AT&T, and Mitsubishi.
- Thus *you cannot legally use arithmetic coding* unless you obtain licenses
- from these companies. (The "fair use" doctrine allows people to implement
- and test the algorithm, but actually storing any images with it is dubious
- at best.)
-
- At least in the short run, I recommend that people not worry about
- arithmetic coding; the space savings isn't great enough to justify the
- potential legal hassles. In particular, arithmetic coding *should not*
- be used for any images to be exchanged on Usenet.
-
-
- ---------------------
-
- For more information about JPEG in general or the free JPEG software in
- particular, contact the Independent JPEG Group at jpeg-info@uunet.uu.net.
-
- --
- tom lane
- organizer, Independent JPEG Group
- tgl@cs.cmu.edu or tgl@netcom.com
-